/**
 * Copyright (c) 2015 www.smarthome.com All rights reserved. <br />
 * 本软件源代码版权归xxxx公司,未经许可不得任意复制与传播.<br />
 *
 */
package com.smarthome.core.workingmonitor.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.springframework.stereotype.Service;

import com.smarthome.base.service.ShUserLogService;
import com.smarthome.core.dictionary.UsertLogTypeService;
import com.smarthome.core.workingmonitor.UserLogService;
import com.smarthome.domain.bean.ShUserLog;
import com.smarthome.domain.bean.ShUsertLogType;
import com.smarthome.domain.vo.boss.Combobox;
import com.smarthome.domain.vo.boss.DataGrid;
import com.smarthome.domain.vo.boss.PageHelper;

@Service("userLogService")
public class UserLogServiceImpl implements UserLogService {

    protected static Logger LOGGER;

    @Resource
    private ShUserLogService shUserLogService;
    
    @Resource
    private UsertLogTypeService usertLogTypeService;
    
    

    @Override
    public DataGrid dataGrid(ShUserLog userLog, PageHelper page) {
        return shUserLogService.queryShUserLogs(userLog, page);
    }



	@Override
	public List<Combobox> typeCombobox(boolean flag) {
		List<Combobox> result = new ArrayList<>();
		if(flag) {
			Combobox combobox = new Combobox();
			combobox.setValue("");
			combobox.setText("--请选择--");
			combobox.setSelected(true);
			result.add(combobox);
		}
		ShUsertLogType userLogType = new ShUsertLogType();
		userLogType.setOrderField("id");
		userLogType.setOrderFieldType("ASC");
		userLogType.setIsDel(0L);
		List<ShUsertLogType> userLogTypes = usertLogTypeService.queryUsertLogType(userLogType);
		//转combobox
		for(ShUsertLogType usertLogType:userLogTypes) {
			Combobox combobox = new Combobox();
			combobox.setValue(usertLogType.getId().toString());
			combobox.setText(usertLogType.getName());
			result.add(combobox);
		}
		return result;
	}
    
    
   

}
